local ServerOHOH = _G.ServerOHOH;
local M = ServerOHOH.class.new(script, ServerOHOH.files.BaseComponent());

function M.new(self,...)
	return M(self,...);
end;

function M.ctor(self, parent)
	M.super.ctor(self, parent);
	self.DataBase=self.parent:GetComponent(ServerOHOH.load.Server_PlayerDataComponent())
	self.data=self.DataBase:GetData("set_data")
end;


function M.Set(self,key,v)
	if not self.data[key] then
		return false
	end
	
	self.DataBase:Execut(function()
		if self.data[key]==0 then
			self.data[key]=1
		else
			self.data[key]=0
		end
	end);

	return true
end

function M.dtor(self)
	M.super.dtor(self);
end;

ServerOHOH.load.ServerFunctionManager():SetHandle(ServerOHOH.load.FunctionList().set_change, function(player,key,value)

	local Settings=player:GetComponent(ServerOHOH.load.Server_SettingsComponent());
	if Settings  then
		return Settings:Set(key,value)
	end
	return false
end);

return M